package fag.core.game.test;

import fag.core.game.Doodad;
import fag.core.geometry.Vector2D;

public class Ball extends Doodad {

	public Vector2D speed = new Vector2D(Math.random() * 200, Math.random() * 200);
	
	public boolean frozen = false;
	
	public Ball() {
		super(new BallModel());
	}
	
	public void bounce(Vector2D normal) {
		speed = speed.add(normal.mul(normal.dot(speed.mul(-1)) * 2));
	}
	
	public void step(double dt) {
		
		if(!frozen) {
			//speed = speed.mul(1 - (dt * 0.1));
			setLocation(getX() + speed.x * dt, getY() + speed.y * dt);
		}
	}
}
